import java.util.Scanner;

public class TestDay17 {

    //杨辉三角的变形
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        //n代表行数
        //输出第n行的第一个偶数的位置
        if(n <= 2){
            System.out.println(-1);
        }
        else if((n - 1) % 2 == 0){
            System.out.println(2);
        }else if(n % 4 == 0){
            System.out.println(3);
        }else {
            System.out.println(4);
        }

    }

    public static void main(String[] args) {

        //全部转小写
        //然后遍历一次
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String p = scanner.nextLine();

        str = str.toLowerCase();
        p = p.toLowerCase();
        int count = 0;
        for (int i = 0; i <str.length() ; i++) {
            if(str.charAt(i) == p.charAt(0)){
                count++;
            }
        }
        System.out.println(count);
    }

}
